﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using Shohdi.DataHandler;
using System.Data.Common;

/// <summary>
/// Summary description for StoredProceduresClass
/// </summary>
public class StoredProceduresClass
{

    public static DataTable getReportNoOfUsersSectorsArea(DateTime fromDate, DateTime toDate, bool IsEmployee, bool IsCompleted)
    {
        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);
        con.OpenConnection();

        DbParameter fromDatePrm = con.createParameter();
        fromDatePrm.ParameterName = "@fromDate";
        fromDatePrm.DbType = DbType.DateTime;
        fromDatePrm.Value = fromDate;

        DbParameter toDatePrm = con.createParameter();
        toDatePrm.ParameterName = "@toDate";
        toDatePrm.DbType = DbType.DateTime;
        toDatePrm.Value = toDate;


        DbParameter IsEmployeePrm = con.createParameter();
        IsEmployeePrm.ParameterName = "@IsEmployee";
        IsEmployeePrm.DbType = DbType.Boolean;
        IsEmployeePrm.Value = IsEmployee;


        DbParameter IsCompletedPrm = con.createParameter();
        IsCompletedPrm.ParameterName = "@IsCompleted";
        IsCompletedPrm.DbType = DbType.Boolean;
        IsCompletedPrm.Value = IsCompleted;


        DataTable dtRet = con.SelectInDataTable("dbo.getReportNoOfUsersSectorsArea", CommandType.StoredProcedure, fromDatePrm, toDatePrm, IsEmployeePrm, IsCompletedPrm);




        con.CloseConnection();


        return dtRet;
    }




    public static DataTable getReportNoOfUsersFoldersArea(DateTime fromDate, DateTime toDate, bool IsEmployee, bool IsCompleted)
    {
        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);
        con.OpenConnection();

        DbParameter fromDatePrm = con.createParameter();
        fromDatePrm.ParameterName = "@fromDate";
        fromDatePrm.DbType = DbType.DateTime;
        fromDatePrm.Value = fromDate;

        DbParameter toDatePrm = con.createParameter();
        toDatePrm.ParameterName = "@toDate";
        toDatePrm.DbType = DbType.DateTime;
        toDatePrm.Value = toDate;


        DbParameter IsEmployeePrm = con.createParameter();
        IsEmployeePrm.ParameterName = "@IsEmployee";
        IsEmployeePrm.DbType = DbType.Boolean;
        IsEmployeePrm.Value = IsEmployee;


        DbParameter IsCompletedPrm = con.createParameter();
        IsCompletedPrm.ParameterName = "@IsCompleted";
        IsCompletedPrm.DbType = DbType.Boolean;
        IsCompletedPrm.Value = IsCompleted;


        DataTable dtRet = con.SelectInDataTable("dbo.getReportNoOfUsersFoldersArea", CommandType.StoredProcedure, fromDatePrm, toDatePrm, IsEmployeePrm, IsCompletedPrm);




        con.CloseConnection();


        return dtRet;
    }


    public static DataTable getReportNoOfUsersSaudiArea(DateTime fromDate, DateTime toDate, bool IsEmployee, bool IsCompleted)
    {
        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);
        con.OpenConnection();

        DbParameter fromDatePrm = con.createParameter();
        fromDatePrm.ParameterName = "@fromDate";
        fromDatePrm.DbType = DbType.DateTime;
        fromDatePrm.Value = fromDate;

        DbParameter toDatePrm = con.createParameter();
        toDatePrm.ParameterName = "@toDate";
        toDatePrm.DbType = DbType.DateTime;
        toDatePrm.Value = toDate;


        DbParameter IsEmployeePrm = con.createParameter();
        IsEmployeePrm.ParameterName = "@IsEmployee";
        IsEmployeePrm.DbType = DbType.Boolean;
        IsEmployeePrm.Value = IsEmployee;


        DbParameter IsCompletedPrm = con.createParameter();
        IsCompletedPrm.ParameterName = "@IsCompleted";
        IsCompletedPrm.DbType = DbType.Boolean;
        IsCompletedPrm.Value = IsCompleted;


        DataTable dtRet = con.SelectInDataTable("dbo.getReportNoOfUsersSaudiArea", CommandType.StoredProcedure, fromDatePrm, toDatePrm, IsEmployeePrm, IsCompletedPrm);




        con.CloseConnection();


        return dtRet;
    }



    public static DataTable getReportUserDetails(DateTime fromDate, DateTime toDate, bool IsEmployee)
    {
        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);
        con.OpenConnection();

        DbParameter fromDatePrm = con.createParameter();
        fromDatePrm.ParameterName = "@fromDate";
        fromDatePrm.DbType = DbType.DateTime;
        fromDatePrm.Value = fromDate;

        DbParameter toDatePrm = con.createParameter();
        toDatePrm.ParameterName = "@toDate";
        toDatePrm.DbType = DbType.DateTime;
        toDatePrm.Value = toDate;


        DbParameter IsEmployeePrm = con.createParameter();
        IsEmployeePrm.ParameterName = "@IsEmployee";
        IsEmployeePrm.DbType = DbType.Boolean;
        IsEmployeePrm.Value = IsEmployee;





        DataTable dtRet = con.SelectInDataTable("dbo.getReportUserDetails", CommandType.StoredProcedure, fromDatePrm, toDatePrm, IsEmployeePrm);




        con.CloseConnection();


        return dtRet;
    }




	public StoredProceduresClass()
	{
		//
		// TODO: Add constructor logic here
		//
	}
}